<?php

/**
 * Product form.
 *
 * @package    corpon
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class ProductForm extends BaseProductForm
{
  public function configure()
  {
      unset($this['created_at']);

      $years = range(date('Y'), date('Y')+10);
      $this->setWidget('start_date',new sfWidgetFormJQueryDate(array('config' => '{firstDay: 1, changeMonth: true, changeYear: true}', 'culture' => 'en', 'date_widget' => new sfWidgetFormDate(array('years' => array_combine($years, $years), 'format' => '%month%%day%%year%' )))));
      $this->setWidget('end_date',new sfWidgetFormJQueryDate(array('config' => '{firstDay: 1, changeMonth: true, changeYear: true}', 'culture' => 'en', 'date_widget' => new sfWidgetFormDate(array('years' => array_combine($years, $years), 'format' => '%month%%day%%year%' )))));


      $this->widgetSchema['photo1'] = new sfWidgetFormInputFile(array('label' => 'Photo 1',));
      $this->widgetSchema['photo2'] = new sfWidgetFormInputFile(array('label' => 'Photo 2',));
      $this->widgetSchema['photo3'] = new sfWidgetFormInputFile(array('label' => 'Photo 3',));

      $this->validatorSchema['photo1'] = new sfValidatorFile(array('required' => false,'path' => sfConfig::get('sf_upload_dir').'/products', 'max_size' => 4194304, 'mime_types' => array('image/jpeg', 'image/pjpeg', 'image/png', 'image/x-png', 'image/gif')),array('invalid' => 'Invalid File.', 'required'   => 'Choose a logo.', 'mime_types' => 'Format invalid. The file must be JPEG, PNG o GIF.', 'max_size' => 'Error Max size. The file is greater than 4MB.'));
      $this->validatorSchema['photo2'] = new sfValidatorFile(array('required' => false,'path' => sfConfig::get('sf_upload_dir').'/products', 'max_size' => 4194304, 'mime_types' => array('image/jpeg', 'image/pjpeg', 'image/png', 'image/x-png', 'image/gif')),array('invalid' => 'Invalid File.', 'required'   => 'Choose a logo.', 'mime_types' => 'Format invalid. The file must be JPEG, PNG o GIF.', 'max_size' => 'Error Max size. The file is greater than 4MB.'));
      $this->validatorSchema['photo3'] = new sfValidatorFile(array('required' => false,'path' => sfConfig::get('sf_upload_dir').'/products', 'max_size' => 4194304, 'mime_types' => array('image/jpeg', 'image/pjpeg', 'image/png', 'image/x-png', 'image/gif')),array('invalid' => 'Invalid File.', 'required'   => 'Choose a logo.', 'mime_types' => 'Format invalid. The file must be JPEG, PNG o GIF.', 'max_size' => 'Error Max size. The file is greater than 4MB.'));
  }
}
